package com.yotoodesign.dianba.bean;

/**
 * 歌手信息
 * @author zhuchuanming
 *
 */
public class Singer extends BaseData{
	public final static String MALE = "M";
	public final static String FEMALE = "F";
	
	public final static String HUA = "0";
	public final static String GANG = "1";
	
	/*
	 * 性别 M：男，F:女
	 */
	private  String sex;
	/*
	 * 区域 0:华语，1：港台
	 */
	private String area;
	
	public Singer(){
		
	}
	
	public Singer(String name,String pinyin){
		this.setName(name);
		this.setPinyin(pinyin);
	}
	
	public String toString(){
		return "id=" + this.getId() + ",pinyin=" + this.getPinyin()
				+ ",singerName=" + this.getName() + ",imageUrl="
				+ this.getImageUrl() + ",sex=" + sex + ",favoritesCount="
				+ this.getFavoritesCount();
	}
	
	public String toXmlString(){
		StringBuffer result = new StringBuffer();
		result.append(XML_HEADER+CRLF);
		result.append("<singers>"+CRLF);
		result.append(TAB+"<singer>"+CRLF);
		result.append(TAB+TAB+"<id>"+(this.getId()==null?"":this.getId())+"</id>"+CRLF);
		result.append(TAB+TAB+"<name>"+(this.getName()==null?"":this.getName())+"</name>"+CRLF);
		result.append(TAB+TAB+"<desc>"+(this.getDesc()==null?"":this.getDesc())+"</desc>"+CRLF);
		result.append(TAB+TAB+"<image_url>"+(this.getImageUrl()==null?"":this.getImageUrl())+"</image_url>"+CRLF);
		result.append(TAB+TAB+"<pinyin>"+(this.getPinyin()==null?"":this.getPinyin())+"</pinyin>"+CRLF);
		result.append(TAB+TAB+"<sex>"+(this.getSex()==null?"":this.getSex())+"</sex>"+CRLF);
		result.append(TAB+TAB+"<favorites_count>"+this.getFavoritesCount()+"</favorites_count>"+CRLF);
		result.append(TAB+TAB+"<area>"+this.getArea()+"</area>"+CRLF);
		
		String ts = "";
		if(this.getTags()!=null){
			for(int i = 0 ;i<this.getTags().size();i++){
				ts += getTags().get(i).getName()+",";
			}
			if(ts.indexOf(",")!=-1){
				ts = ts.substring(0, ts.length()-1);
			}
		}
		
		result.append(TAB+TAB+"<tags>"+ts+"</tags>"+CRLF);
		result.append(TAB+TAB+"<create_date>"+(this.getCreateDate()==null?"":this.getCreateDate())+"</create_date>"+CRLF);
		result.append(TAB+TAB+"<update_date>"+(this.getUpdateDate()==null?"":this.getUpdateDate())+"</update_date>"+CRLF);
		result.append(TAB+"</singer>"+CRLF);
		result.append("</singers>"+CRLF);
		
		return result.toString();
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getArea() {
		return area;
	}

	public void setArea(String area) {
		this.area = area;
	}


}
